package cn.tedu.mvcboot01.controller;

import cn.tedu.mvcboot01.pojo.dto.UserDTO;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;

@Controller
public class UserController {
//    @RequestMapping("/v1/users/login")
//    @ResponseBody
//    public String userLogin(HttpServletRequest request) {
//        String username = request.getParameter("username");
//        String password = request.getParameter("password");
//        return username + ":" + password;
//    }

//    @RequestMapping("/v1/users/login")
//    @ResponseBody
//    public String userLogin(String username,String password){
//        return username+"-"+password;
//    }

    @RequestMapping("/v1/users/login")
    @ResponseBody
    public String userLogin(UserDTO userDTO) {
        String username = userDTO.getUsername();
        String password = userDTO.getPassword();
        return username + "&" + password;
    }
}
